<template>
  <div>
    <el-dialog
      :visible.sync="dialogVisible"
      :close-on-click-modal="false"
      title="自动添加规则修改"
      width="900px"
      @close="close"
    >
      <div v-loading="dialogLoading">
        <el-form
          ref="form"
          :model="form"
          label-width="120px"
          size="small"
        >
          <!-- 头部开关按钮 -->
          <el-form-item prop="labelOpen" label="面向会员开放">
            <el-switch v-model="form.RuleOpen" />
            <span class="rule-tip">打开开关即要求满足以下所有规则，关闭则只需要满足一项</span>
          </el-form-item>
          <el-divider />
          <!-- 规则列表 -->
          <el-row>
            <span class="rule-index">1</span>
            <el-select v-model="form.value" placeholder="请选择" size="medium">
              <el-option
                v-for="item in options"
                :key="item.value"
                :label="item.label"
                :value="item.value"
              />
            </el-select>
            <span class="rule-mid-word">大于</span>
            <el-input
              v-model.trim="form.money"
              placeholder="请输入..."
              type="text"
              style="width: 150px"
            />
            <span class="rule-mid-word">元</span><br>
            <el-checkbox v-model="checked" class="rule-checkbox">不包含后台人工操作充值</el-checkbox>
          </el-row>
        </el-form>
      </div>
      <el-divider />
      <!-- 底部按钮 -->
      <el-button size="small">添加规则</el-button>
      <div slot="footer" class="dialog-footer">
        <el-button size="medium" round @click="hide">取 消</el-button>
        <el-button size="medium" round type="primary">保 存</el-button>
      </div>
    </el-dialog>
  </div>
</template>

<script>
export default {
  data: function() {
    return {
      // 配置
      // 状态
      dialogVisible: false,
      dialogLoading: false,
      checked: true, // 多选框状态
      // 数据
      form: {
        RuleOpen: true,
        rule: [1, 2, 1, 3, 1],
        value: '1'
      },
      options: [ // 规则种类
        {
          value: '1',
          label: '累计充值金额'
        },
        {
          value: '2',
          label: '累计充值笔数'
        },
        {
          value: '3',
          label: '单次充值金额'
        },
        {
          value: '4',
          label: '最近一段时间充值金额'
        }
      ]
    }
  },
  computed: {},
  watch: {},
  created() {
  },
  mounted() {
  },
  methods: {
    /**
     * 数据组
     */
    // 获取规则列表
    getRulesList() {},
    /**
     * 按钮组
     */
    /**
     * 状态组
     */
    open() {
      this.show()
      return new Promise((resolve, reject) => {
        this.resolve = resolve
        this.reject = reject
      })
    },

    show() {
      this.dialogVisible = true
    },

    hide() {
      this.resolve = null
      this.reject = null
      this.dialogVisible = false
    },

    close() {
      this.dialogLoading = false
      this.form.RuleOpen = true
      this.$refs.form.resetFields()
    },
    /**
     * 方法组
     */
    // 提交数据
    onSubmit() {

    }
  }
}
</script>

<style scoped>
.rule-tip{
  margin-left: 20px;
}
.rule-index{
  height: 36px;
  line-height: 36px;
  width: 36px;
  background-color: #f0f2f5;
  color: #333;
  text-align: center;
  border-radius: 100%;
  margin-right: 10px;
}
.rule-mid-word{
  margin: 0 10px;
}
.rule-checkbox{
  margin: 20px 50px;
}
</style>
